package com.tuijian.controller;


import com.alibaba.fastjson.JSON;
import com.tuijian.service.track.TrackService;
import com.tuijian.vo.DataResponse;
import com.tuijian.vo.TrackingData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/track")
public class TrackController {

    @Resource
    private TrackService trackService;

    @RequestMapping("/collect")
    public String collect(@RequestBody TrackingData trackingdata){
        System.out.println(trackingdata);
        trackService.send2kafka(trackingdata);
        return JSON.toJSONString(DataResponse.builder()
                .success(true)
                .message("get")
                .build());
    }

}
